package com.infomanage.dao;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.infomanage.bean.SearchBean;
import com.infomanage.exception.DaoException;
import com.infomanage.po.Department;
import com.infomanage.po.EmergencyAccidentSummary;
import com.infomanage.po.RuleMeeting;

public class RuleMeetingDAO extends BaseDAO<RuleMeeting>{
	
	public List<RuleMeeting> findByFields(SearchBean searchBean) throws DaoException {
		List result = super.findByFields(new Class[] {Department.class },
				RuleMeeting.class, new String[] {"deptId" },
				new String[] {"deptId" }, searchBean);
		return parseResult(result);
	}
	
	public List<RuleMeeting> parseResult(List result){
		Iterator it = result.iterator();
		List<RuleMeeting> list = new ArrayList<RuleMeeting>();
		while (it.hasNext()) {
			Object[] o = (Object[]) it.next();
			RuleMeeting bean = (RuleMeeting) o[0];
			list.add(bean);
		}
		return list;
	}
	
	public int count(SearchBean searchBean){
		return super.count(new Class[] {Department.class },
				RuleMeeting.class, new String[] {"deptId" },
				new String[] {"deptId" }, searchBean);
	}
}
